<include file="Common/common" />
<style type="text/css">
	input::-webkit-input-placeholder {
		color: rgb(201,211,215);
	}
	input:-ms-input-placeholder{
		color: rgb(201,211,215);
	}
	input::-moz-placeholder, textarea::-moz-placeholder {
		color: rgb(201,211,215);
	}input::-webkit-input-placeholder {
		 color: rgb(201,211,215);
	 }
	input:-ms-input-placeholder{
		color: rgb(201,211,215);
	}
	input::-moz-placeholder, textarea::-moz-placeholder {
		color: rgb(201,211,215);
	}
	.layui-elem-quote{
		border-left: 0;
	}
</style>
<body>
	
	<div class="layui-tab-item layui-show">
		<div class="layui-main">
			<br>
			<blockquote class="layui-elem-quote" style=" color: rgb(240,222,112);background: rgb(57,61,73)">
				<p>注册须知：</p>
				<p>一、请仔细填写账户资料，全球系统统一管理；</p>
				<p>二、如遇申诉需要验证您的手机号码和姓名，请如实填写；</p>
				<p>三、您必须为年满18周岁，55周岁以下完全民事行为能力的合法公民，不符合请勿注册。</p>
			</blockquote>
			<br><br>

			<form class="layui-form" id="register-form" action="" style="color: rgb(240,222,112);">
				<div class="layui-form-item">
					<label class="layui-form-label">登录帐号</label>
					<div class="layui-input-block">
							<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="text" name="regAccount" value="" lay-verify="required"  autocomplete="off" placeholder="登录账号" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">推荐人账号</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="text" name="topAccount" value="{$userInfo['account']}" lay-verify="required"  autocomplete="off" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">真实姓名</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="text" name="truename" value="" lay-verify="required"  autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">手机号码</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="text" name="phone" value="" lay-verify="required|phone"  autocomplete="off" placeholder="匹配、找回密码通知" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">登录密码</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="password" name="password" value="" lay-verify="required"  autocomplete="off" placeholder="登录密码" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">重复登录密码</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="password" name="confirm_password" value="" lay-verify="required"  autocomplete="off" placeholder="确认登录密码" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">交易密码</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="password" name="safe_password" value="" lay-verify="required"  autocomplete="off" placeholder="交易密码" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">重复交易密码</label>
					<div class="layui-input-block">
						<input style="background-color: rgba(255,255,255,0.2); color: rgb(240,222,112);" type="password" name="confirm_safe_password" value="" lay-verify="required"  autocomplete="off" placeholder="确认交易密码" class="layui-input">
					</div>
				</div>
				<!-- <div class="layui-form-item">
					<label class="layui-form-label">注册金额</label>
					<div class="layui-input-inline">
						<select name="regMoney">
							<option value="3000" selected="">3000</option>
							<option value="5000">5000</option>
							<option value="10000">10000</option>
							<option value="30000">30000</option>
							<option value="50000">50000</option>
						</select>
					</div>
					
				</div> -->
				<div class="layui-form-item">

					<div class="layui-input-block">
						<input type="checkbox" name="checkedAgreement" id="agree"  lay-skin="primary" title="&nbsp;&nbsp;" checked="">
						我已完全了解该项目的所有风险，确认自主利用闲散时间、资金参与。
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block" style="margin-left: 105px;">
						<button  style="color: rgb(240,222,112);background: rgb(57,61,73);font-size: 16px"  class="layui-btn" lay-submit="" lay-filter="btn-register">确认注册</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>

<script type="text/javascript">
	layui.use(['form'], function(){
		var form = layui.form
  		,layer = layui.layer;

  		form.render();

  		//监听提交表单
		form.on('submit(btn-register)', function(data){
			var truename = data.field.truename.trim();
			var password = data.field.password.trim();
			var confirm_password = data.field.confirm_password.trim();
			var safe_password = data.field.safe_password.trim();
			var confirm_safe_password = data.field.confirm_safe_password.trim();
			var is_agree = $('#agree').is(':checked');
			// console.log(is_agree);

			if ( password != confirm_password ) {
                layer.msg('<span style="color: rgb(240,222,112);">两次登录密码不一致</span>');
				return false;
			}
			if (password.length < 6 || confirm_password.length < 6) {
                layer.msg('<span style="color: rgb(240,222,112);">安全密码长度过短，建议长于>=6</span>');
				return false;
			}

			if ( safe_password != confirm_safe_password ) {
               layer.msg('<span style="color: rgb(240,222,112);">两次交易密码不一致</span>');
				return false;
			}
			if (safe_password.length < 6 || confirm_safe_password.length < 6) {
               layer.msg('<span style="color: rgb(240,222,112);">交易密码长度过短，建议长于>=6</span>');
				return false;
			}

			if (is_agree == false) {
				layer.msg('<span style="color: rgb(240,222,112);">请同意！</span>');
				return false;
			}

			// var  reg= /[a-zA-Z] {0,}/gi;
			var reg = /^[\u4e00-\u9fa5]+$/gi;
           	if(!reg.test(truename)) { 
				layer.msg('<span style="color: rgb(240,222,112);">真实姓名只能为中文汉字</span>');
			  	// $('#truename').val("");
			  	return false;
		  	}  


			layer.confirm('确定要注册会员？',{offset:'none'},function(index){
				$.ajax({
		            type: "post",
		            url: "{:U('Common/ctrl_register')}",
		            data: data.field,
		            dataType: "json",
		            success: function(rtJson){
		            	if (rtJson.code == 1) {
		            		$('#register-form')[0].reset();//重置表单
                            layer.msg('<span style="color: rgb(240,222,112);">'+rtJson.msg+'</span>');
		            	}else{
                            layer.msg('<span style="color: rgb(240,222,112);">'+rtJson.msg+'</span>');
		            	}
		            }
		        });
			});
	        return false;
		});
	});


</script>
<include file="Common/footer" />